﻿<%@ Page Language="C#" AutoEventWireup="true" Inherits="website_admin_sales_ordersettings"
    CodeFile="ordersettings.aspx.cs" %>

<%@ Register Src="../../admin/_root/_controls/ctlNavBar.ascx" TagName="ctlNavBar"
    TagPrefix="uc1" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
    <title>积分兑换订单设置</title>
    <script type="text/javascript" src="../_static/_jQuery/jquery-1.3.2.min.js"></script>
    <script type="text/javascript" src="../../admin/_static/_jQuery/jquery_validator.js"></script>
    <script type="text/javascript" language="javascript" src="../_common/scripts/util.js"></script>
    <script language="javascript" src="../_static/_jQuery/jquery-fileupload.js" type="text/javascript"></script>
    <script language="javascript" src="../_static/_jQuery/interface.js" type="text/javascript"></script>
    <script src="../../_common/datepicker/WdatePicker.js" type="text/javascript"></script>
    <link href="../../_common/styles/style-compressed.css" rel="stylesheet" type="text/css" />
    <link href="../../_common/styles/product_items.css" rel="stylesheet" type="text/css" />
    <link href="../../_common/styles/shopping_order_layout.css" rel="stylesheet" type="text/css" />
    <link href="../../_common/styles/form_layout.css" rel="stylesheet" type="text/css" />
    <link href="../_common/styles/form_v2_0.css" rel="stylesheet" type="text/css" />
    <link href="../../_common/flexigrid/flexigrid.css" rel="stylesheet" type="text/css" />
    <script type="text/javascript">
        function tab_switch(obj) {
            if (obj.parentElement.className != "currentBtn") {
                $("#" + obj.id).parent().parent().children().removeClass("currentBtn");
                $("#" + obj.id).parent().addClass("currentBtn");

                var $p = $("#" + obj.id).parent().parent().children();
                for (var i = 0; i < $p.length; i++) {
                    if ($p[i].firstChild.rel == obj.rel)
                        $("#tab_" + $p[i].firstChild.rel).css("display", "");
                    else
                        $("#tab_" + $p[i].firstChild.rel).css("display", "none");
                }
            }
        }
        var pre_scrollLeft = 0;
        /// 自动校对左右滚动条
        $(window).resize(function () {
            if (document.getElementById("scrool_left")) {
                if (pre_scrollLeft != document.getElementById("scrool_left").scrollLeft) {
                    pre_scrollLeft = document.getElementById("scrool_left").scrollLeft;
                    $(".hDivBox").css("margin-left", -pre_scrollLeft);
                }
            }
        }); 
        $(document).ready(function () { 
            LoadingItemsData();
        }); 
        function LoadingItemsData() {
            $.ajax({
                async: true,
                type: "POST",
                url: prependOrgName("/website_admin/sales/ordersettings.aspx"),
                data: {
                    otype: "loadingshipmentlist",
                    objectid: getUrlParam("objectid")
                },
                beforeSend: function () {
                    $("#divItemsList").html("<div class=\"tDiv\"></div>" + $("#divTreeLoading").html() + "<div class=\"vGrip\"></div>");
                },
                success: function (data, textStatus) {
                    $("#divItemsList").html("");
                    $("#divItemsList").html("<div class=\"mDiv\"></div>" + data + "<div class=\"vGrip\"></div>");
                }
            });
        }
        function SendShipmentNotice() {
            var noticetype = "";

            if ($("#cbxNoticeType_1").attr("checked")) {
                noticetype = "1,";
            }
            if ($("#cbxNoticeType_2").attr("checked")) {
                noticetype += "2,";
            }
            if (noticetype == "") {
                alert("请选择发送通知的方式！");
                return;
            }
            if ($("#txtShipmentNumber").val() == "") {
                alert("请填写快递单号！");
                return;
            }
            else {
                noticetype = noticetype.substring(0, noticetype.length - 1);
                $.ajax({
                    type: "POST",
                    url: prependOrgName("/website_admin/sales/ordersettings.aspx"),
                    data: {
                        otype: "sendshipmentnotice",
                        objectid: getUrlParam("objectid"),
                        ordernumber: $("#txtOrderNumber").val(),
                        email: $("#txtEmail").val(),
                        phone: $("#txtPhoneNumbers").val(),
                        shipmenttype: $("#txtShipmentType").val(),
                        shipmentnumber: $("#txtShipmentNumber").val(),
                        shipmentdate: $("#txtShipmentDate").val(),
                        noticetype: noticetype,
                        noticecontent: $("#txtNoticeContent").val()
                    },
                    beforeSend: function () {
                        $("#Button6").attr("disabled", true);
                        $("#shipmentprogress").css("display", "block");
                    },
                    async: true,
                    success: function (data, textStatus) {
                        if (data == "succeeded") {
                            alert("发送成功！");
                            $("#panelShipmentSettings").css("display", "none");
                            $("#shipmentprogress").css("display", "none");
                            LoadingItemsData();
                        }
                        else {
                            alert(data);
                        }
                        $("#Button6").attr("disabled", false);
                    }
                });
            }
        }
    </script> 
</head>
<body scrool="no" style="margin: 0px; padding: 0px; background: #F0F0F0;">
    <div id="divTreeLoading" style="display: none;">
        <div class="hDiv">
            <table style="background-color: #FFFFFF; table-layout: fixed; width: 100%; height: 100%;
                margin-top: 30px;" cellpadding="0" cellspacing="0">
                <tr>
                    <td style="text-align: center; border: 0px; vertical-align: middle;">
                        <div style="width: 200px; margin-left: 30px;">
                            <img border="0" src="../_imgs/admin/progress.gif" />
                            <span style="line-height: 42px;">正在加载数据 ... </span>
                        </div>
                    </td>
                </tr>
            </table>
        </div>
    </div>
    <div id="panelShipmentSettings" style="display: none;">
        <div id="shipmentprogress" class="loading_box">
            <div class="loading_panel">
                <div style="padding: 10px; margin: auto;">
                    <img border="0" src="../_imgs/admin/progress.gif" />操作执行中 ...<br />
                </div>
            </div>
            <div class="loading_shadow">
            </div>
        </div>
        <table height="100%" cellspacing="0" cellpadding="0" class="floatPanelForm">
            <tbody>
                <tr>
                    <td class="titlebar">
                        <span>发送快递信息</span>
                    </td>
                </tr>
                <tr>
                    <td style="padding: 15px;">
                        <table class="stdTable" cellspacing="0" cellpadding="3">
                            <colgroup>
                                <col width="85" />
                                <col />
                            </colgroup>
                            <tbody>
                                <tr>
                                    <td>
                                        <label for="txtShipmentType">
                                            快递公司：</label>
                                    </td>
                                    <td>
                                        <input type="text" id="txtShipmentType" name="txtShipmentType" class="textbox" style="width: 200px;"
                                            runat="server" />
                                    </td>
                                </tr>
                                <tr style="height: 5px;">
                                    <td>
                                    </td>
                                </tr>
                                <tr>
                                    <td>
                                        <label for="txtShipmentNumber">
                                            快递单号：</label>
                                    </td>
                                    <td>
                                        <input type="text" id="txtShipmentNumber" name="txtShipmentNumber" class="textbox" style="width: 200px;" />
                                    </td>
                                </tr>
                                <tr style="height: 5px;">
                                    <td>
                                    </td>
                                </tr>
                                <tr>
                                    <td>
                                        <label for="txtShipmentDate">
                                            寄出时间：</label>
                                    </td>
                                    <td>
                                        <input type="text" id="txtShipmentDate" name="txtShipmentDate" class="textbox" readonly
                                            onfocus="WdatePicker({dateFmt:'yyyy-MM-dd'});" runat="server" style="width: 120px;" />
                                    </td>
                                </tr>
                                <tr style="height: 5px;">
                                    <td>
                                    </td>
                                </tr>
                                <tr>
                                    <td>
                                        <label for="txtNoticeContent">
                                            通知方式：</label>
                                    </td>
                                    <td>
                                        <span style="width: auto; float: left;">
                                            <input type="checkbox" id="cbxNoticeType_1" name="NoticeType" value="1" style="border: 0px;" />
                                            <label for="cbxNoticeType_1">
                                                邮件</label>
                                        </span><span style="width: auto; float: left;">
                                            <input type="checkbox" id="cbxNoticeType_2" name="NoticeType" value="2" style="border: 0px;" />
                                            <label for="cbxNoticeType_2">
                                                短信</label>
                                        </span>
                                    </td>
                                </tr>
                                <tr style="height: 5px;">
                                    <td>
                                    </td>
                                </tr>
                                <tr>
                                    <td>
                                        <label for="txtPhoneNumbers">
                                            手机号码：</label>
                                    </td>
                                    <td>
                                        <input type="text" id="txtPhoneNumbers" name="txtPhoneNumbers" class="textbox" runat="server" style="width: 200px;" />
                                    </td>
                                </tr>
                                <tr style="height: 5px;">
                                    <td>
                                    </td>
                                </tr>
                                <tr>
                                    <td>
                                        <label for="txtNoticeContent">
                                            备注信息：</label>
                                    </td>
                                    <td>
                                        <textarea id="txtNoticeContent" name="txtNoticeContent" class="textbox" rows="4"
                                            style="width: 300px" runat="server"></textarea>
                                    </td>
                                </tr>
                            </tbody>
                        </table>
                    </td>
                </tr>
                <tr>
                    <td class="footer">
                        <input id="Button6" runat="server" class="btn_o_120" value="发送信息" type="button" onclick="SendShipmentNotice();" />
                        <input type="button" value="取消" id="Button7" class="btn_o_120" onclick="$('#panelShipmentSettings').css('display', 'none');" />
                    </td>
                </tr>
            </tbody>
        </table>
        <div class="floatPanelBG">
        </div>
    </div>
    <script type="text/javascript">
        <!--
        function ____doPostBack(eventTarget) {
            var theForm = document.forms["form1"];
            if (!theForm) {
                theForm = document.form1;
            }
            if (!theForm.onsubmit || (theForm.onsubmit() != false)) {
                theForm.____EVENTTARGET.value = eventTarget;
                theForm.submit();
            }
        }
        // -->
    </script>
    <div id="success" style="position: absolute; z-index: 300; height: 130px; width: 284px;
        left: 50%; top: 50%; margin-left: -150px; margin-top: -80px;">
        <div style="position: absolute; z-index: 300; width: 270px; height: 90px; background-color: #FFFFFF;
            border: solid #6699CC 1px; font-size: 14px;">
            <div style="height: 64px; line-height: 150%; padding: 0px 3px 0px 3px;" align="center">
                <br />
                <table>
                    <tr>
                        <td valign="top">
                            <img border="0" src="../_imgs/admin/progress.gif" />
                        </td>
                        <td valign="middle" style="font-size: 14px; width: 150px;">
                            操作执行中 ...<br />
                        </td>
                    </tr>
                </table>
                <br />
            </div>
        </div>
        <div style="position: absolute; width: 270px; height: 108px; z-index: 299; left: 4px;
            top: 5px; background-color: #E8E8E8; border: #E8E8E8 1px solid; display: none;">
        </div>
    </div>
    <script type="text/javascript">
        document.getElementById("success").style.display = "none"; 
    </script>
    <script language="JavaScript1.2" src="../../_common/scripts/divcover.js" type="text/javascript"></script>
    <form id="form1" runat="server">
    <input id="txtOrderNumber" name="txtOrderNumber" type="hidden" runat="server" />
    <input id="txtEmail" name="txtEmail" type="hidden" runat="server" />
    <input id="txtPhone" name="txtPhone" type="hidden" runat="server" />
    <input type="hidden" name="____EVENTTARGET" id="____EVENTTARGET" value="" />
    <table cellpadding="0" cellspacing="0" class="WIN-Form-Layout">
        <tr style="height: 32px;">
            <td colspan="1" class="WIN-Form-Title-Bar">
                <span>积分兑换订单</span>
            </td>
        </tr>
        <tr style="height: 100%; background: #ffffff;">
            <td valign="top" style="padding: 10px 10px 10px 0px;">
                <div class="content">
                    <div class="checkoutBox noBorder" id="errorMsg" runat="server" style="background: #FFFDCF;
                        width: 762px; line-height: 21px; padding: 10px;" visible="false">
                    </div>
                    <div class="checkoutBox noBorder">
                        <div class="tabContainer">
                            <ul class="tabHead">
                                <li class="currentBtn"><a id="a21" href="javascript:void(0);" onclick="tab_switch(this);"
                                    title="常规" rel="21">常规</a></li>
                                <li><a id="a22" href="javascript:void(0);" onclick="tab_switch(this);"
                                    title="快递发送信息" rel="22">快递发送信息</a></li>
                            </ul>
                        </div>
                        <div class="clear">
                        </div>
                        <ul class="infoList edit" id="tab_21">
                            <li style="width: 100%; height: auto;">
                                <div style="overflow-y: scroll; overflow-x: hidden; height: 430px; margin-left: auto;
                                    margin-right: auto; padding: 10px 20px 10px 20px; width: auto;">
                                    <div class="innercontent" id="mainOrderContent">
                                        <div class="orderContent" style="line-height: 22px;">
                                            <label>
                                                订单编号：</label><asp:Label ID="lblOrderNumber" runat="server"></asp:Label>
                                            <label>
                                                订购时间：</label>
                                            <asp:Label ID="lblOrderDate" runat="server"></asp:Label>
                                            <label>
                                                订单总额：</label><asp:Label ID="lblTotalPrice" runat="server"></asp:Label></div>
                                        <div class="orderContent" style="line-height: 22px;">
                                            <label>
                                                订单状态：</label><asp:Label ID="lblOrderStatus" runat="server"></asp:Label><label>配送方式：</label><span>快递</span>
                                        </div>
                                        <div id="shippingAddressContentInfo" class="checkoutBox" style="line-height: 22px;">
                                            <h4 class="title1">
                                                我的收货地址</h4>
                                            <div class="clear">
                                                &nbsp;</div>
                                            <ul class="infoList">
                                                <li>
                                                    <label>
                                                        收货联系人：</label>
                                                    <asp:Label ID="lblShipToName" runat="server"></asp:Label></li>
                                                <li>
                                                    <label>
                                                        手&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;机：</label>
                                                    <asp:Label ID="lblShipMobile" runat="server"></asp:Label></li>
                                                <li>
                                                    <label>
                                                        联系电话：</label>
                                                    <asp:Label ID="lblShipTel" runat="server"></asp:Label></li>
                                                <li>
                                                    <label>
                                                        地&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;区：</label>
                                                    <asp:Label ID="lblShipCounties" runat="server"></asp:Label></li>
                                                <li>
                                                    <label>
                                                        邮&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;编：</label>
                                                    <asp:Label ID="lblShipZip" runat="server"></asp:Label></li>
                                                <li>
                                                    <label>
                                                        联系地址：</label>
                                                    <asp:Label ID="lblShipAddress" runat="server"></asp:Label></li>
                                            </ul>
                                        </div>
                                        <div class="checkoutBox noBorder">
                                            <h4 class="title1">
                                                订单结算信息
                                            </h4>
                                            <table class="shopCart" id="shopCart">
                                                <thead>
                                                    <tr>
                                                        <th scope="col">
                                                            商品名称
                                                        </th>
                                                        <th scope="col" style="width: 80px;">
                                                            数量
                                                        </th>
                                                        <th scope="col" style="width: 80px;">
                                                            积分
                                                        </th>
                                                        <th scope="col" style="width: 100px;">
                                                            小计
                                                        </th>
                                                    </tr>
                                                </thead>
                                                <tbody id="tbdCardItems">
                                                    <asp:Repeater ID="rptOrderItems" runat="server">
                                                        <ItemTemplate>
                                                            <tr>
                                                                <td style="text-align: left;">
                                                                    <h4>
                                                                        <a href="product_info.aspx?productid=<%#Eval("ProductId") %>" title="<%# Eval("ProductName")%>"
                                                                            target="_blank" style="padding-left: 0px;">
                                                                            <%# Eval("ProductName")%></a>
                                                                    </h4>
                                                                </td>
                                                                <td style="display: none;">
                                                                    --
                                                                </td>
                                                                <td>
                                                                    <%# Eval("Quantity")%>
                                                                </td>
                                                                <td>
                                                                    <span>
                                                                        <%# Eval("UnitPrice").ToString()%></span>
                                                                </td>
                                                                <td>
                                                                    <span>
                                                                        <%# (decimal.Parse(Eval("UnitPrice").ToString()) * int.Parse(string.IsNullOrEmpty(Eval("Quantity").ToString()) ? "0" : Eval("Quantity").ToString())).ToString()%></span>
                                                                </td>
                                                            </tr>
                                                        </ItemTemplate>
                                                        <FooterTemplate>
                                                            <tr class="extend">
                                                                <td class="textAlign" nowrap="nowrap">
                                                                </td>
                                                                <td>
                                                                </td>
                                                                <td>
                                                                </td>
                                                                <td>
                                                                </td>
                                                            </tr>
                                                        </FooterTemplate>
                                                    </asp:Repeater>
                                                </tbody>
                                            </table>
                                            <div class="finalPrice" id="finalPrice">
                                                <div class="priceAreaRight">
                                                    <ul class="priceArea">
                                                        <li><span>合计积分：</span><em id="emTotalCost" runat="server"></em></li></ul>
                                                </div>
                                            </div>
                                        </div>
                                    </div>
                                </div>
                            </li>
                        </ul>
                        <ul class="infoList list" id="tab_22" style="display: none;">
                            <li>
                                <table cellpadding="0" cellspacing="0" class="stdTable">
                                    <tbody>
                                        <tr style="height: 100%;">
                                            <td valign="top">
                                                <div class="flexigrid" id="divItemsList">
                                                </div>
                                            </td>
                                        </tr>
                                    </tbody>
                                </table>
                            </li>
                        </ul>
                        <div class="clear">
                        </div>
                    </div>
                </div>
            </td>
        </tr>
        <tr style="height: 45px;">
            <td class="WIN-Form-Bottom">
                <input id="Button5" runat="server" class="btn_o_120" value="发送快递信息" type="button"
                    onclick="$('#panelShipmentSettings').css('display', '');" />
                <input type="button" value="关闭窗口" id="Button2" class="btn_o_120" onclick="window.close();" />
            </td>
        </tr>
    </table>
    </form>
</body>
</html>
